<script>
import Vue from 'vue'
import storage from './utils/storage'
// import onLogin from '@/utils/login'

// import { getUserInfo } from "@/api/common"
export default {
	onLaunch: async function () {
		console.log('onLaunch')
		Vue.prototype.$storage = storage
		// if (!storage.hasStorage('access_token')) {
		// 	await onLogin()
		// }
		let systemInfo = uni.getSystemInfoSync()
		let menu = uni.getMenuButtonBoundingClientRect()
		let menuHeight = menu.height //胶囊高度
		let menuTop = menu.top //胶囊与顶部的距离
		//导航栏高度= （胶囊顶部距离-状态栏高度） x 2 + 胶囊的高度
		let navigatorHeight = (menu.top - systemInfo.statusBarHeight) * 2 + menu.height
		//总高度 = 状态栏的高度 + 导航栏高度	
		let totalHeight = systemInfo.statusBarHeight + navigatorHeight
		Vue.prototype.StatusBar = systemInfo.statusBarHeight;
		Vue.prototype.navigatorHeight = navigatorHeight;
		Vue.prototype.totalHeight = totalHeight;
		Vue.prototype.screenHeight = systemInfo.screenHeight;
		if (systemInfo.platform === 'ios') {
			Vue.prototype.system = 'ios';
      // iOS 系统
    } else if (systemInfo.platform === 'android') {
      // Android 系统
    }
		console.log(Vue.prototype.StatusBar, systemInfo, 'yyyyyyyyyyy')
		// const { code, data } = await getHomeInfo()
		// if (code === 602) {
		// 	uni.navigateTo({
		// 		url: '/pages/invitation/index?firend_id=5&&timestamp=' + Date.parse(new Date())
		// 	})
		// }
	},
	onShow: async function () {
		// uni.getNetwor kType({
		// 	success: (res) => {    
		// 		console.log(res);
		// 		if(res.networkType === 'none'){
		// 			uni.showModal({
		// 				title:"提示",
		// 				content:'网络连接错误',
		// 				confirmText:'重试',
		// 				success: (e) => {
		// 					if(e.confirm){
		// 						let page = getCurrentPages();
		// 						console.log(page[page.length-1]);
		// 						page[page.length-1].onShow()
		// 					}
		// 				}
		// 			})
		// 		}
		// 	}
		// })
	},
	onHide: function () {
		// console.log('App Hide');
	}
};
</script>

<style lang="scss">
@import './styles/common.scss';
@import './styles/main.scss';
// @import './uni.scss';

// page {
//   color: #333;
//   font-size: 16px;
//   /* background: #f8f8f8; */
//   min-height: 100vh;
//   box-sizing: border-box;
//   -webkit-font-smoothing: antialiased;
//   font-family: 'PingFang SC', Helvetica, 'STHeiti STXihei', 'Microsoft YaHei', Tohoma, Arial, sans-serif;
// }
/* 解决头条小程序组件内引入字体不生效的问题 */
/* #ifdef MP-TOUTIAO */



/* #endif */
</style>
